<?php

use Illuminate\Database\Eloquent\ModelNotFoundException;

class AdminLoginController extends BaseController {

	protected $layout = 'layouts.saltkin.login';

	public function Index(){
		$this->layout->title = trans('form.login');
		$this->layout->content = View::make('admin.login.index');
	}

	public function Login(){
		$this->layout = null;

		$data = array(
			'email' => Input::get('email', false),
			'password' => Input::get('password', false),
		);

		if (Auth::attempt($data)) {
		    return Redirect::to('admin/user/')->with('message', 'You are now logged in!');
		} else {
		    return Redirect::to('admin/login')->with('message', trans('form.errorlogin'));
		}
	}
}
